package cn.chenfyuan.demoapplication.config;

import com.jagregory.shiro.freemarker.ShiroTags;
import freemarker.template.Configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;

import javax.annotation.PostConstruct;

/**
 * @author linweijian
 * @version V1.0
 * @Description:
 * @Package cn.chenfyuan.demoapplication.config
 * @date 2018/9/3
 */
@Component
public class ShiroTagFreeMarkerConfig {
    @Autowired
    private FreeMarkerConfigurer freeMarkerConfigurer;

    @PostConstruct
    public void afterPropertiesSet() throws Exception {
        freeMarkerConfigurer.getConfiguration().setSharedVariable("shiro", new ShiroTags());

    }

}
